package cn.ad.server.web.spring.service.components.http.client;

import cn.ad.server.web.spring.service.httpclient4.ByteArrayWrapStream;

import java.io.IOException;
import java.util.Map;

/**
 * http请求执行simple接口
 * @author wangwei
 *
 */
public interface AdHttpExecutorUtil {
	
	/**
	 * get方法
	 * @param url
	 * @param headers
	 * @param timeout 超时时间，不设置超时时间 timeout=-1为默认值
	 * @return
	 * @throws ResponseHandleException
	 * @throws IOException
	 */
	AdHttpResponse<ByteArrayWrapStream> doGetExecute(String url, Map<String, Object> headers, int timeout) throws ResponseHandleException, IOException;
	
	/**
	 * post form表单
	 * @param url
	 * @param headers
	 * @param forms
	 * @param timeout 超时时间，不设置超时时间 timeout=-1为默认值
	 * @return
	 * @throws ResponseHandleException
	 * @throws IOException
	 */
	AdHttpResponse<ByteArrayWrapStream> doPostExecute(String url, Map<String, Object> headers, Map<String, Object> forms, int timeout) throws ResponseHandleException, IOException;
	
	/**
	 * post json
	 * @param url
	 * @param headers
	 * @param json
	 * @param timeout 超时时间，不设置超时时间 timeout=-1为默认值
	 * @return
	 * @throws ResponseHandleException
	 * @throws IOException
	 */
	AdHttpResponse<ByteArrayWrapStream> doPostExecute(String url, Map<String, Object> headers, String json, int timeout) throws ResponseHandleException, IOException;

	/**
	 * post buffer
	 * @param url
	 * @param headers
	 * @param buffer
	 * @param timeout 超时时间，不设置超时时间 timeout=-1为默认值
	 * @return
	 * @throws ResponseHandleException
	 * @throws IOException
	 */
	AdHttpResponse<ByteArrayWrapStream> doPostExecute(String url, Map<String, Object> headers, byte[] buffer, int timeout) throws ResponseHandleException, IOException;
	
//	AdHttpResponse<ByteArrayWrapStream> doPostExecute(String url,Map<String,Object> headers,OutputStream outputStream,int timeout) throws ResponseHandleException, IOException;
}
